import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TransferOrderVO, TransferOrderForm, TransferOrderQuery } from '@/api/retail/transferOrder/types';

/**
 * 查询转账订单列表
 * @param query
 * @returns {*}
 */

export const listTransferOrder = (query?: TransferOrderQuery): AxiosPromise<TransferOrderVO[]> => {
  return request({
    url: '/retail/transferOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询转账订单详细
 * @param id
 */
export const getTransferOrder = (id: string | number): AxiosPromise<TransferOrderVO> => {
  return request({
    url: '/retail/transferOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增转账订单
 * @param data
 */
export const addTransferOrder = (data: TransferOrderForm) => {
  return request({
    url: '/retail/transferOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改转账订单
 * @param data
 */
export const updateTransferOrder = (data: TransferOrderForm) => {
  return request({
    url: '/retail/transferOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除转账订单
 * @param id
 */
export const delTransferOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/retail/transferOrder/' + id,
    method: 'delete'
  });
};
